<?php

// On demande les 5 derniers evenements au modéle
include_once('models/get_events.php');
$events = get_events(0, 5);

// On effectue du traitement sur les données (controleur)
// Ici, on doit surtout sécuriser l'affichage
foreach($events as $cle => $event)
{
	$events[$cle]['nom'] = htmlspecialchars($event['nom']);
	$events[$cle]['description']=nl2br(htmlspecialchars($event['description']));
	$events[$cle]['chemin'] = $event['chemin'];
}

$slides=slide_events(0,1);
foreach ($slides as $cle => $slide)
{
	$slides[$cle]['nom'] = htmlspecialchars($slide['nom']);
	$slides[$cle]['description']=nl2br(htmlspecialchars($slide['description']));
}

$slide2=slide_events(1,1);
foreach ($slide2 as $cle => $slide)
{
	$slide2[$cle]['nom'] = htmlspecialchars($slide['nom']);
	$slide2[$cle]['description']=nl2br(htmlspecialchars($slide['description']));
}

$slide3=slide_events(2,1);
foreach ($slide3 as $cle => $slide)
{
	$slide3[$cle]['nom'] = htmlspecialchars($slide['nom']);
	$slide3[$cle]['description']=nl2br(htmlspecialchars($slide['description']));
}

$slide4=slide_events(3,1);
foreach ($slide4 as $cle => $slide)
{
	$slide4[$cle]['nom'] = htmlspecialchars($slide['nom']);
	$slide4[$cle]['description']=nl2br(htmlspecialchars($slide['description']));
}

$users = get_users(0, 5);

// On effectue du traitement sur les données (controleur)
// Ici, on doit surtout sécuriser l'affichage
foreach($users as $cle => $user)
{
	$users[$cle]['pseudo'] = htmlspecialchars($user['pseudo']);
	$users[$cle]['pays']=nl2br(htmlspecialchars($user['pays']));
}


// On affiche la vue
include 'vues/acceuil.php';
?>